﻿using MDT.LifeSewagePlatform.Conmmon;
using MDT.LifeSewagePlatform.InterfaceService;
using MDT.LifeSewagePlatform.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace MDT.LifeSewagePlatform.ServiceInstance.Controllers
{
    [Route("api/setalarm")]
    [ApiController]
    [Authorize]
    public class SetAlarmController : BaseController
    {
        #region prop and ctor
        [Autowired]
        private  ISetAlarmService setAlarmService { get; set; }
        public SetAlarmController()
        {
        }
        #endregion

        #region method servcie
        /// <summary>
        /// 获取设置预警
        /// </summary>
        /// <returns></returns>
        [HttpGet()]
        public async Task<BaseMessage> GetSetAlarm()
        {
            return await setAlarmService.GetSetAlarm();
        }
        /// <summary>
        /// 更新设置
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPut("{id}")]
        public async Task<BaseMessage> UpdateSetAlarm(int id,[FromForm]UpdateSetAlarm model)
        {
            return await setAlarmService.UpdateAlarm(model,id,GetUserID());
        }
        #endregion

    }
}
